package com.zhr.server;

import com.zhr.util.XmlUtil;

public class WeixinRequest {
	private String toUserName;
	private String fromUserName;
	private String createTime;
	private String msgType;
	private String content;
	private String picUrl;
	private String location_X;
	private String location_Y;
	private String scale;
	private String label;
	private String title;
	private String description;
	private String url;
	private String event;
	private String eventKey;
	private String msgId;

	public WeixinRequest() {
		super();
	}

	public WeixinRequest(String xml) {
		XmlUtil.fillBean(xml, this);
	}
	
	public static void main(String[] args) {
		new WeixinRequest("<xml><Content><![CDATA[this is a test]]></Content><ToUserName><![CDATA[toUser]]></ToUserName><FromUserName><![CDATA[fromUser]]></FromUserName><CreateTime><![CDATA[1348831860]]></CreateTime><MsgType><![CDATA[text]]></MsgType><Event><![CDATA[EVENT]]></Event><PicUrl><![CDATA[this is a url]]></PicUrl><Location_X><![CDATA[23.134521]]></Location_X><Location_Y><![CDATA[113.358803]]></Location_Y><Scale><![CDATA[20]]></Scale><Label><![CDATA[位置信息]]></Label><Title><![CDATA[公众平台官网链接]]></Title><Description><![CDATA[公众平台官网链接]]></Description><Url><![CDATA[url]]></Url><EventKey><![CDATA[EVENTKEY]]></EventKey><MsgId><![CDATA[1234567890123456]]></MsgId></xml>");
	}
	
	static {
//		StringBuilder sb = new StringBuilder();
//		sb.append("<xml>").append("\n");
//		sb.append("<ToUserName><![CDATA[toUser]]></ToUserName>").append("\n");
//		sb.append("<FromUserName><![CDATA[fromUser]]></FromUserName>").append("\n");
//		sb.append("<CreateTime>1348831860</CreateTime>").append("\n");
//		//text、 image、location、link、event
//		sb.append("<MsgType><![CDATA[text]]></MsgType>").append("\n");
//		//text
//		sb.append("<Content><![CDATA[this is a test]]></Content>").append("\n");
//		//image
//		sb.append("<PicUrl><![CDATA[this is a url]]></PicUrl>").append("\n");
//		//location
//		sb.append("<Location_X>23.134521</Location_X>").append("\n");
//		sb.append("<Location_Y>113.358803</Location_Y>").append("\n");
//		sb.append("<Scale>20</Scale>").append("\n");
//		sb.append("<Label><![CDATA[位置信息]]></Label>").append("\n");
//		//link
//		sb.append("<Title><![CDATA[公众平台官网链接]]></Title>").append("\n");
//		sb.append("<Description><![CDATA[公众平台官网链接]]></Description>").append("\n");
//		sb.append("<Url><![CDATA[url]]></Url>").append("\n");
//		//event
//		sb.append("<Event><![CDATA[EVENT]]></Event>").append("\n");
//		sb.append("<EventKey><![CDATA[EVENTKEY]]></EventKey>").append("\n");
//		
//		sb.append("<MsgId>1234567890123456</MsgId>").append("\n");
//		sb.append("</xml>");
	}

	public WeixinRequest(String toUserName, String fromUserName,
			String createTime, String msgType, String content, String event) {
		super();
		this.toUserName = toUserName;
		this.fromUserName = fromUserName;
		this.createTime = createTime;
		this.msgType = msgType;
		this.content = content;
		this.event = event;
	}

	public String getToUserName() {
		return toUserName;
	}

	public void setToUserName(String toUserName) {
		this.toUserName = toUserName;
	}

	public String getFromUserName() {
		return fromUserName;
	}

	public void setFromUserName(String fromUserName) {
		this.fromUserName = fromUserName;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public String getMsgType() {
		return msgType;
	}

	public void setMsgType(String msgType) {
		this.msgType = msgType;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getEvent() {
		return event;
	}

	public void setEvent(String event) {
		this.event = event;
	}

	public String getPicUrl() {
		return picUrl;
	}

	public void setPicUrl(String picUrl) {
		this.picUrl = picUrl;
	}

	public String getLocation_X() {
		return location_X;
	}

	public void setLocation_X(String location_X) {
		this.location_X = location_X;
	}

	public String getLocation_Y() {
		return location_Y;
	}

	public void setLocation_Y(String location_Y) {
		this.location_Y = location_Y;
	}

	public String getScale() {
		return scale;
	}

	public void setScale(String scale) {
		this.scale = scale;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getEventKey() {
		return eventKey;
	}

	public void setEventKey(String eventKey) {
		this.eventKey = eventKey;
	}

	public String getMsgId() {
		return msgId;
	}

	public void setMsgId(String msgId) {
		this.msgId = msgId;
	}

	@Override
	public String toString() {
		return "WeixinRequest [toUserName=" + toUserName + ", fromUserName="
				+ fromUserName + ", createTime=" + createTime + ", msgType="
				+ msgType + ", content=" + content + ", picUrl=" + picUrl
				+ ", location_X=" + location_X + ", location_Y=" + location_Y
				+ ", scale=" + scale + ", label=" + label + ", title=" + title
				+ ", description=" + description + ", url=" + url + ", event="
				+ event + ", eventKey=" + eventKey + ", msgId=" + msgId + "]";
	}
	
	


}
